//
//  Author.m
//  归档和恢复
//
//  Created by 安怀远 on 15/6/18.
//  Copyright (c) 2015年 安怀远. All rights reserved.
//
//如果父类也继承了Nscoding协议  在encodeWithCoder 方法上加上[super encodeWithCode: acoder]
//在 initWithCoder 中加 self=[super initWiticoder:aDecoder]


#import "Author.h"

@implementation Author


+(id)initAuthorWithInfo:(NSString *)name age:(NSString *)age phoneNum:(NSString *)phoneNum headImage:(UIImage *)headImage bookName:(NSString *)bookName{

    Author *a=[[Author alloc] init];
    a.age=age;
    a.name=name;
    a.phoneNum=phoneNum;
    a.headImage=headImage;
    a.bookName=bookName;
    
    return a;

}
//编码
-(void)encodeWithCoder:(NSCoder *)aCoder{
    [super encodeWithCoder:aCoder];
    [aCoder encodeObject:_bookName forKey:@"bookName"];

}

//解码
-(id)initWithCoder:(NSCoder *)aDecoder{
    self =[super initWithCoder:aDecoder];

    if(self){
    
        _bookName=[aDecoder decodeObjectForKey:@"bookName"];
    }
    return  self;
}
@end
